<?php

require_once("functions.php");
$db = connect_db();

$out = get_header();

$sql= "select * FROM fields";

$res = mysql_query($sql, $db);

$out .= generate_menu();

$out .= "<h2>Fields overview</h2>\n";
$out .= "<table>\n";
$out .= "<tr><th>Variable</th><th>Extra variable</th><th>actions</th></tr>\n";

while (($row = mysql_fetch_array($res)) !== FALSE) {
	$id = $row["id"];
//	var_dump($row);
	$out .= "<tr><td>{$row["variable"]}</td><td>{$row['extra_variable']}<td><a href=\"edit_field.php?action=edit&amp;id=$id\">edit</a> | <a href=\"edit_values.php?id=$id&amp;action=edit\">values</a></td></tr>\n";
}

$out .="</table>\n";

$out .= "<a href=\"edit_field.php?id=new\">add field</a>";

$out .= get_footer();


echo $out;

?>
